package com.yixincaipiao.weight.recyclerview;

import android.content.Context;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.yixincaipiao.R;


/**
 * Created by cundong on 2015/10/9.
 * <p/>
 * ListView/GridView/RecyclerView 分页加载时使用到的FooterView
 */
public class LoadingFooter extends RelativeLayout {

    protected State mState = State.Normal;
    private TextView mLoadingText;

    public LoadingFooter(Context context) {
        super(context);
        inflate(context, R.layout.list_loading_layout, this);
        setState(State.Normal);
    }

    public State getState() {
        return mState;
    }


    /**
     * 设置状态
     *
     * @param status
     */
    public void setState(State status) {
        if (mState == status) {
            return;
        }
        mState = status;

        switch (status) {
            case Loading:
                mLoadingText = (TextView) findViewById(R.id.loading_text);
                mLoadingText.setText("修改加载中...");
                break;
            case Normal:
            default:
                break;
        }
    }

    public static enum State {
        Normal/**正常*/
        , Loading/**加载中..*/
    }
}